﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using Model;
using DL;


namespace BL
{
    public class Login
    {
        public void Inloggen(string username, string passwoord, bool checkbox)
        {
            Model.DataModelManager manager = new DataModelManager();
            
            if (manager.getPaswoord(username) == passwoord)
            {
                string id = manager.getPersoonID(username).ToString();
                string type = manager.getAccountType(username);

                if (checkbox == true)
                {
                    HttpCookie eenCookie = new HttpCookie("UserSettings");
                    eenCookie["id" + type] = id;
                    eenCookie["username" + type] = username;
                    eenCookie.Expires = DateTime.Now.AddDays(1d);
                    Response.Cookies.Add(eenCookie);
                }
                else

                {
                    Session["id" + type] = id;
                    Session["username" + type] = username;
                }

                Response.Write("Gelukt");
            }
            else
            {
                Response.Write("Probleempje");
            }
        }
    }
}
